package com.example.wechatbot.controller;

import com.example.wechatbot.service.MessageDispatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WechatController {
    @Autowired
    private MessageDispatcher messageDispatcher;

    @PostMapping("/wechat/message")
    public String handleWechatMessage(@RequestBody String message) {
        // 解析提问人和问题
        String questioner = "提问人";
        String question = message;

        return messageDispatcher.dispatch(questioner, question);
    }
}
